home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 2
/
Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso
/
Aminet
/
misc
/
amag
/
am9305b.lha
/
Tips & Tricks
/
NewBorder.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-23
|
2KB
|
74 lines
/*
* DrawGadgetBorder.c demonstriert die Funktion
* DrawGadgetBorder()
* Aufruf mit DICE:
* dcc DrawGadgetBorder.c -o DrawGadgetBorder
*/
#include <intuition/intuition.h>
struct IntuitionBase *IntuitionBase;
struct Window *Window;
struct IntuiMessage *IntuiMessage;
struct IntuiText GadgetText={1,0,0,2,2,0,"Gadget",0};
struct Gadget Gadget={ 0,50,29,52,12,GADGHCOMP,
RELVERIFY,BOOLGADGET,0,0,&GadgetText,0,0,0,0};
struct NewWindow NewWindow={ 120,30,160,60,0,1,
GADGETUP,WINDOWDRAG | ACTIVATE | WINDOWDEPTH,
&Gadget,0,0,0,0,0,0,0,0,WBENCHSCREEN};
SHORT XY[10];
/* Gadget-Rahmen */
struct Border GadgetBorder={0,0,1,0,0,5,XY,0};
/* Zeichnet eine Doppelumrandung für das
* angegebene Gadget */
void DrawGadgetBorder(struct Window *Window,
struct Gadget *Gadget)
{
SHORT L,T,W,H;
L=Gadget->LeftEdge; /* Größe des Gadgets auslesen */
T=Gadget->TopEdge;
W=Gadget->Width;
H=Gadget->Height;
/* Koordinaten-Feld für die 1. Umrandung erstellen */
XY[0]=-1; XY[1]=-1;
XY[2]=W; XY[3]=-1;
XY[4]=W; XY[5]=H;
XY[6]=-1; XY[7]=H;
XY[8]=-1; XY[9]=-1;
/* 1. Umrandung zeichnen */
DrawBorder(Window->RPort,&GadgetBorder,L,T);
/* Koordinaten-Feld für die 2. Umrandung erstellen */
XY[0]=-3; XY[1]=-3;
XY[2]=W+2; XY[3]=-3;
XY[4]=W+2; XY[5]=H+2;
XY[6]=-3; XY[7]=H+2;
XY[8]=-3; XY[9]=-3;
/* 2. Umrandung zeichnen */
DrawBorder(Window->RPort,&GadgetBorder,L,T);
}
void main()
{
IntuitionBase=(struct IntuitionBase *)
OpenLibrary("intuition.library",0);
if( IntuitionBase )
{
/* Fenster öffnen */
Window=(struct Window *)OpenWindow(&NewWindow);
if( Window )
{
/* Doppel-Border zeichnen */
DrawGadgetBorder(Window,&Gadget);
/* Warten auf Gadget-Klick */
WaitPort(Window->UserPort);
IntuiMessage=(APTR)GetMsg(Window->UserPort);
ReplyMsg(IntuiMessage);
/* Fenster wieder schließen */
CloseWindow(Window);
}
CloseLibrary(IntuitionBase);
}
}